home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 4
/
004.d81
/
grades 2
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
4KB
|
156 lines
2 sp$=" "
5 rem**load "grades 2",8
10 rem**grade averaging*sort routines
20 rem**john l eubanks,ph.d
30 rem**pineville, louisiana 71360
40 rem**
50 rem**03/13/84
60 rem**
65 print"[147]"
68 print"**********[158]teacher's gradebook [146]**********[159]"
70 print""
73 print" version 2.0 [146][159]"
75 print""
80 print" john l eubanks,ph.d[146][159]"
82 print:print:print:print
85 for i=1to2000 :nexti:print"[147]"
100 print"you may average any number of grades "
110 print"for any number of students and "
115 print"calculate the letter grades for your[146] "
120 print"grading system."
130 print"if you wish to make a hard copy[146]"
135 print"connect your printer now. [146]"
140 print""
150 print"[158]this program does not save to disk.[146]"
153 print"you should send data to the printer[146]"
155 print"or copy the data by hand before [146]"
157 print"turning off the computer. [146][159]"
158 print""
165 print
167 dim n$(200),g(50),a(200),gl$(200)
170 input"press return to begin";r$
180 if r$="" then 300
290 rem**input variable length and dim
300 print"[147]"
320 input"enter the number of students";n%:print
340 input"how many grades per student ";ng
343 print
360 print"you may enter the names of";n%;"students"
365 print"with a maximum of";ng;"grades per student.":print
370 input"press return to continue";c$
375 if c$="" then 400
400 print"[147]"
490 rem**input student names
500 forx=1ton%:print"[147]"
510 print"when you are asked,type the"
520 print"student's name--last first"
530 print"[158]do not use commas in entry[159][146]"
540 print""
550 print"what is student's name?":print
560 input n$(x): print
570 rem**input grades
580 input"how many grades for [146][158]this[146][159] student";sg:print
595 if sg=<ng then 603
600 if sg>ng then print"you can only enter";ng;"grades"
602 print"<press a key>":poke198,0:wait198,1:goto580
603 let s=0
605 rem**input grades
610 for y=1tosg:print"[147]"
620 print"what is student's grade #"y" ?"
625 input g(y)
635 rem**calculate grade average
640 s=g(y)+s
650 next y
660 a(x)=s/sg:a(x)=int(a(x)+.5)
670 z=z+1
680 next x: rem**main loop return
700 rem**input letter grade values
710 print"[147]"
730 print"enter the (numerical) lower"
740 print"limits for each letter grade":print
750 input"lower limit of 'a'";b:print
760 input"lower limit of 'b'";c:print
770 input"lower limit of 'c'";d:print
780 input"lower limit of 'd'";e:print
785 rem**calculate upper limits
790 let bl=abs(b-1):let cl=abs(c-1):let dl=abs(d-1):let el=abs(e-1)
840 rem**display grade values
850 print"[147]":print"your grading system is: [146][159]"
860 print"[158]a=";b;"and above"
870 print"b=";c;"to";bl
880 print"c=";d;"to";cl
890 print"d=";e;"to";dl
900 print"f=";el;"and below[159]":print:print
902 input"press return to continue";v$
905 if v$="" then 910
910 rem**convert num averages to letters
915 for x=1ton%
920 if a(x) =>b then gl$(x) ="a"
930 if a(x) =>c and a(x) <b then gl$(x) ="b"
940 if a(x) =>d and a(x) <c then gl$(x) ="c"
950 if a(x) =>e and a(x) <d then gl$(x) ="d"
960 if a(x) =<el then gl$(x) ="f"
965 next x
970 print"[147]":print"to arrange by name,type 'n'"
975 print:print"to arrange by average,type 'g'":print
980 input"type 'n' or 'g'";m$
985 if m$="g" then gosub 5000
987 if m$="n" then 3060
990 rem**print headings to screen
1000 print"[147]"
1010 print"student name";tab(23);"average";tab(33);"grade"
1020 print:print
1025 rem**output print loop for screen
1030 for x=1toz
1032 f=f+1
1035 if f>20 then gosub 7000
1040 print n$(x);tab(26);a(x);tab(36);gl$(x)
1050 nextx
1070 print
1080 rem**
1990 rem**hard copy option
2000 print"type 'p' to send to printer"
2005 print"type 'q' to quit"
2010 input"enter 'p' or 'q'";p$
2020 if p$="p" then 2060
2030 goto3020
2050 rem**output print loop for printer
2060 open 4,4 :cmd4
2070 print"student name","average","grade"
2080 print:print
2090 for x=1 to z
3000 print n$(x)left$(sp$,24-len(n$(x)))a(x)left$(sp$,16-len(str$(a(x))))gl$(x)
3010 next x:print#4:close4
3020 rem now is the time to end
3030 goto63000
3035 :
3040 :
3050 rem**arrange by name**bubble sort
3060 t=n%-1
3070 flip=0:for s=1tot:ifn$(s)<=n$(s+1)then 3130
3080 switch$=n$(s):ha=a(s):hg$=gl$(s)
3090 n$(s)=n$(s+1):a(s)=a(s+1):gl$(s)=gl$(s+1)
3100 n$(s+1)=switch$:a(s+1)=ha:gl$(s+1)=hg$
3110 flip=1:t=s
3130 next s:if flip=1 then3070
3140 goto 1000
4990 rem**arrange by grades*bubble sort
5000 t=n%-1
5010 flip=0:for s=1to t:if a(s)>=a(s+1) then 5060
5020 ha=a(s):switch$=n$(s):hg$=gl$(s)
5030 a(s)=a(s+1):n$(s)=n$(s+1):gl$(s)=gl$(s+1)
5040 a(s+1)=ha:n$(s+1)=switch$:gl$(s+1)=hg$
5050 flip=1:t=s
5060 next s:if flip=1 then 5010
5070 return
6990 rem**stop when screen fills
7000 print chr$(18);"hit any key to continue"
7010 get an$:if an$="" then 7010
7020 f=0:print chr$(146)
7030 return
63000 print"[147][144]want to try again? (y/n)":poke198,0:wait198,1:getz$
63002 ifz$<>"y"andz$<>"n"then63000
63004 ifz$="y"then170
63005 print"[147]load"chr$(34)"payload"chr$(34)",8":print"run"
63010 poke631,13:poke632,13:poke198,2:end